﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AfterlifeLib.GameScreens;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using AfterlifeLib;
using AfterlifeLib.Input;

namespace Afterlife.Screens
{
    public class CreditsScreen : GameScreen
    {
        string[] credits = {
                               "Credits",
                               "",
                               "Programmer",
                               "Ruben van Gulik",
                               "",
                               "Graphics Artist",
                               "Ruben van Gulik",
                           };

        public CreditsScreen()
            : base()
        {

        }

        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

            if (InputState.Cancel || InputState.Accept)
            {
                ExitScreen();
            }
        }

        public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
            SpriteFont font = ScreenManager.Font;

            spriteBatch.Begin();
            for (int i = 0; i < credits.Length; i++)
            {
                Vector2 origin = font.MeasureString(credits[i]);
                origin.X /= 2; origin.Y /= 2;

                spriteBatch.DrawString(font, credits[i], new Vector2(ScreenManager.GraphicsDevice.Viewport.Width / 2, 100 + i * font.LineSpacing) , Color.White, 0, origin, 1, SpriteEffects.None, 0);
            }
            spriteBatch.End();
        }
    }
}
